/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class Seller
    {
    
        private String sellerIdField;

        private String sellerNameField;

        private String sellerLegalNameField;

        private String nicknameField;

        private String glancePageField;

        private String aboutField;

        private String moreAboutField;

        private  SellerLocation locationField;
        private Decimal? averageFeedbackRatingField;

        private Decimal? totalFeedbackField;

        private Decimal? totalFeedbackPagesField;

        private  SellerFeedbackSummary sellerFeedbackSummaryField;
        private  SellerFeedback sellerFeedbackField;

        /// <summary>
        /// Gets and sets the SellerId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SellerId")]
        public String SellerId
        {
            get { return this.sellerIdField ; }
            set { this.sellerIdField= value; }
        }



        /// <summary>
        /// Sets the SellerId property
        /// </summary>
        /// <param name="sellerId">SellerId property</param>
        /// <returns>this instance</returns>
        public Seller WithSellerId(String sellerId)
        {
            this.sellerIdField = sellerId;
            return this;
        }



        /// <summary>
        /// Checks if SellerId property is set
        /// </summary>
        /// <returns>true if SellerId property is set</returns>
        public Boolean IsSetSellerId()
        {
            return  this.sellerIdField != null;

        }


        /// <summary>
        /// Gets and sets the SellerName property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SellerName")]
        public String SellerName
        {
            get { return this.sellerNameField ; }
            set { this.sellerNameField= value; }
        }



        /// <summary>
        /// Sets the SellerName property
        /// </summary>
        /// <param name="sellerName">SellerName property</param>
        /// <returns>this instance</returns>
        public Seller WithSellerName(String sellerName)
        {
            this.sellerNameField = sellerName;
            return this;
        }



        /// <summary>
        /// Checks if SellerName property is set
        /// </summary>
        /// <returns>true if SellerName property is set</returns>
        public Boolean IsSetSellerName()
        {
            return  this.sellerNameField != null;

        }


        /// <summary>
        /// Gets and sets the SellerLegalName property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SellerLegalName")]
        public String SellerLegalName
        {
            get { return this.sellerLegalNameField ; }
            set { this.sellerLegalNameField= value; }
        }



        /// <summary>
        /// Sets the SellerLegalName property
        /// </summary>
        /// <param name="sellerLegalName">SellerLegalName property</param>
        /// <returns>this instance</returns>
        public Seller WithSellerLegalName(String sellerLegalName)
        {
            this.sellerLegalNameField = sellerLegalName;
            return this;
        }



        /// <summary>
        /// Checks if SellerLegalName property is set
        /// </summary>
        /// <returns>true if SellerLegalName property is set</returns>
        public Boolean IsSetSellerLegalName()
        {
            return  this.sellerLegalNameField != null;

        }


        /// <summary>
        /// Gets and sets the Nickname property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Nickname")]
        public String Nickname
        {
            get { return this.nicknameField ; }
            set { this.nicknameField= value; }
        }



        /// <summary>
        /// Sets the Nickname property
        /// </summary>
        /// <param name="nickname">Nickname property</param>
        /// <returns>this instance</returns>
        public Seller WithNickname(String nickname)
        {
            this.nicknameField = nickname;
            return this;
        }



        /// <summary>
        /// Checks if Nickname property is set
        /// </summary>
        /// <returns>true if Nickname property is set</returns>
        public Boolean IsSetNickname()
        {
            return  this.nicknameField != null;

        }


        /// <summary>
        /// Gets and sets the GlancePage property.
        /// </summary>
        [XmlElementAttribute(ElementName = "GlancePage")]
        public String GlancePage
        {
            get { return this.glancePageField ; }
            set { this.glancePageField= value; }
        }



        /// <summary>
        /// Sets the GlancePage property
        /// </summary>
        /// <param name="glancePage">GlancePage property</param>
        /// <returns>this instance</returns>
        public Seller WithGlancePage(String glancePage)
        {
            this.glancePageField = glancePage;
            return this;
        }



        /// <summary>
        /// Checks if GlancePage property is set
        /// </summary>
        /// <returns>true if GlancePage property is set</returns>
        public Boolean IsSetGlancePage()
        {
            return  this.glancePageField != null;

        }


        /// <summary>
        /// Gets and sets the About property.
        /// </summary>
        [XmlElementAttribute(ElementName = "About")]
        public String About
        {
            get { return this.aboutField ; }
            set { this.aboutField= value; }
        }



        /// <summary>
        /// Sets the About property
        /// </summary>
        /// <param name="about">About property</param>
        /// <returns>this instance</returns>
        public Seller WithAbout(String about)
        {
            this.aboutField = about;
            return this;
        }



        /// <summary>
        /// Checks if About property is set
        /// </summary>
        /// <returns>true if About property is set</returns>
        public Boolean IsSetAbout()
        {
            return  this.aboutField != null;

        }


        /// <summary>
        /// Gets and sets the MoreAbout property.
        /// </summary>
        [XmlElementAttribute(ElementName = "MoreAbout")]
        public String MoreAbout
        {
            get { return this.moreAboutField ; }
            set { this.moreAboutField= value; }
        }



        /// <summary>
        /// Sets the MoreAbout property
        /// </summary>
        /// <param name="moreAbout">MoreAbout property</param>
        /// <returns>this instance</returns>
        public Seller WithMoreAbout(String moreAbout)
        {
            this.moreAboutField = moreAbout;
            return this;
        }



        /// <summary>
        /// Checks if MoreAbout property is set
        /// </summary>
        /// <returns>true if MoreAbout property is set</returns>
        public Boolean IsSetMoreAbout()
        {
            return  this.moreAboutField != null;

        }


        /// <summary>
        /// Gets and sets the Location property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Location")]
        public SellerLocation Location
        {
            get { return this.locationField ; }
            set { this.locationField = value; }
        }



        /// <summary>
        /// Sets the Location property
        /// </summary>
        /// <param name="location">Location property</param>
        /// <returns>this instance</returns>
        public Seller WithLocation(SellerLocation location)
        {
            this.locationField = location;
            return this;
        }



        /// <summary>
        /// Checks if Location property is set
        /// </summary>
        /// <returns>true if Location property is set</returns>
        public Boolean IsSetLocation()
        {
            return this.locationField != null;
        }




        /// <summary>
        /// Gets and sets the AverageFeedbackRating property.
        /// </summary>
        [XmlElementAttribute(ElementName = "AverageFeedbackRating")]
        public Decimal AverageFeedbackRating
        {
            get { return this.averageFeedbackRatingField.GetValueOrDefault() ; }
            set { this.averageFeedbackRatingField= value; }
        }



        /// <summary>
        /// Sets the AverageFeedbackRating property
        /// </summary>
        /// <param name="averageFeedbackRating">AverageFeedbackRating property</param>
        /// <returns>this instance</returns>
        public Seller WithAverageFeedbackRating(Decimal averageFeedbackRating)
        {
            this.averageFeedbackRatingField = averageFeedbackRating;
            return this;
        }



        /// <summary>
        /// Checks if AverageFeedbackRating property is set
        /// </summary>
        /// <returns>true if AverageFeedbackRating property is set</returns>
        public Boolean IsSetAverageFeedbackRating()
        {
            return  this.averageFeedbackRatingField != null;

        }


        /// <summary>
        /// Gets and sets the TotalFeedback property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalFeedback")]
        public Decimal TotalFeedback
        {
            get { return this.totalFeedbackField.GetValueOrDefault() ; }
            set { this.totalFeedbackField= value; }
        }



        /// <summary>
        /// Sets the TotalFeedback property
        /// </summary>
        /// <param name="totalFeedback">TotalFeedback property</param>
        /// <returns>this instance</returns>
        public Seller WithTotalFeedback(Decimal totalFeedback)
        {
            this.totalFeedbackField = totalFeedback;
            return this;
        }



        /// <summary>
        /// Checks if TotalFeedback property is set
        /// </summary>
        /// <returns>true if TotalFeedback property is set</returns>
        public Boolean IsSetTotalFeedback()
        {
            return  this.totalFeedbackField != null;

        }


        /// <summary>
        /// Gets and sets the TotalFeedbackPages property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalFeedbackPages")]
        public Decimal TotalFeedbackPages
        {
            get { return this.totalFeedbackPagesField.GetValueOrDefault() ; }
            set { this.totalFeedbackPagesField= value; }
        }



        /// <summary>
        /// Sets the TotalFeedbackPages property
        /// </summary>
        /// <param name="totalFeedbackPages">TotalFeedbackPages property</param>
        /// <returns>this instance</returns>
        public Seller WithTotalFeedbackPages(Decimal totalFeedbackPages)
        {
            this.totalFeedbackPagesField = totalFeedbackPages;
            return this;
        }



        /// <summary>
        /// Checks if TotalFeedbackPages property is set
        /// </summary>
        /// <returns>true if TotalFeedbackPages property is set</returns>
        public Boolean IsSetTotalFeedbackPages()
        {
            return  this.totalFeedbackPagesField != null;

        }


        /// <summary>
        /// Gets and sets the SellerFeedbackSummary property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SellerFeedbackSummary")]
        public SellerFeedbackSummary SellerFeedbackSummary
        {
            get { return this.sellerFeedbackSummaryField ; }
            set { this.sellerFeedbackSummaryField = value; }
        }



        /// <summary>
        /// Sets the SellerFeedbackSummary property
        /// </summary>
        /// <param name="sellerFeedbackSummary">SellerFeedbackSummary property</param>
        /// <returns>this instance</returns>
        public Seller WithSellerFeedbackSummary(SellerFeedbackSummary sellerFeedbackSummary)
        {
            this.sellerFeedbackSummaryField = sellerFeedbackSummary;
            return this;
        }



        /// <summary>
        /// Checks if SellerFeedbackSummary property is set
        /// </summary>
        /// <returns>true if SellerFeedbackSummary property is set</returns>
        public Boolean IsSetSellerFeedbackSummary()
        {
            return this.sellerFeedbackSummaryField != null;
        }




        /// <summary>
        /// Gets and sets the SellerFeedback property.
        /// </summary>
        [XmlElementAttribute(ElementName = "SellerFeedback")]
        public SellerFeedback SellerFeedback
        {
            get { return this.sellerFeedbackField ; }
            set { this.sellerFeedbackField = value; }
        }



        /// <summary>
        /// Sets the SellerFeedback property
        /// </summary>
        /// <param name="sellerFeedback">SellerFeedback property</param>
        /// <returns>this instance</returns>
        public Seller WithSellerFeedback(SellerFeedback sellerFeedback)
        {
            this.sellerFeedbackField = sellerFeedback;
            return this;
        }



        /// <summary>
        /// Checks if SellerFeedback property is set
        /// </summary>
        /// <returns>true if SellerFeedback property is set</returns>
        public Boolean IsSetSellerFeedback()
        {
            return this.sellerFeedbackField != null;
        }






        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetSellerId()) {
                xml.Append("<SellerId>");
                xml.Append(EscapeXML(this.SellerId));
                xml.Append("</SellerId>");
            }
            if (IsSetSellerName()) {
                xml.Append("<SellerName>");
                xml.Append(EscapeXML(this.SellerName));
                xml.Append("</SellerName>");
            }
            if (IsSetSellerLegalName()) {
                xml.Append("<SellerLegalName>");
                xml.Append(EscapeXML(this.SellerLegalName));
                xml.Append("</SellerLegalName>");
            }
            if (IsSetNickname()) {
                xml.Append("<Nickname>");
                xml.Append(EscapeXML(this.Nickname));
                xml.Append("</Nickname>");
            }
            if (IsSetGlancePage()) {
                xml.Append("<GlancePage>");
                xml.Append(EscapeXML(this.GlancePage));
                xml.Append("</GlancePage>");
            }
            if (IsSetAbout()) {
                xml.Append("<About>");
                xml.Append(EscapeXML(this.About));
                xml.Append("</About>");
            }
            if (IsSetMoreAbout()) {
                xml.Append("<MoreAbout>");
                xml.Append(EscapeXML(this.MoreAbout));
                xml.Append("</MoreAbout>");
            }
            if (IsSetLocation()) {
                SellerLocation  location = this.Location;
                xml.Append("<Location>");
                xml.Append(location.ToXMLFragment());
                xml.Append("</Location>");
            } 
            if (IsSetAverageFeedbackRating()) {
                xml.Append("<AverageFeedbackRating>");
                xml.Append(this.AverageFeedbackRating);
                xml.Append("</AverageFeedbackRating>");
            }
            if (IsSetTotalFeedback()) {
                xml.Append("<TotalFeedback>");
                xml.Append(this.TotalFeedback);
                xml.Append("</TotalFeedback>");
            }
            if (IsSetTotalFeedbackPages()) {
                xml.Append("<TotalFeedbackPages>");
                xml.Append(this.TotalFeedbackPages);
                xml.Append("</TotalFeedbackPages>");
            }
            if (IsSetSellerFeedbackSummary()) {
                SellerFeedbackSummary  sellerFeedbackSummary = this.SellerFeedbackSummary;
                xml.Append("<SellerFeedbackSummary>");
                xml.Append(sellerFeedbackSummary.ToXMLFragment());
                xml.Append("</SellerFeedbackSummary>");
            } 
            if (IsSetSellerFeedback()) {
                SellerFeedback  sellerFeedback = this.SellerFeedback;
                xml.Append("<SellerFeedback>");
                xml.Append(sellerFeedback.ToXMLFragment());
                xml.Append("</SellerFeedback>");
            } 
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}